home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3x / cpusetGetPIDList.z / cpusetGetPIDList
Encoding:
Text File  |  2002-10-03  |  5.1 KB  |  133 lines

  1.  
  2.  
  3.  
  4. ccccppppuuuusssseeeettttGGGGeeeettttPPPPIIIIDDDDLLLLiiiisssstttt((((3333xxxx))))                                      ccccppppuuuusssseeeettttGGGGeeeettttPPPPIIIIDDDDLLLLiiiisssstttt((((3333xxxx))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      cpusetGetPIDList - get a list of all PIDs attached to a cpuset
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ####iiiinnnncccclllluuuuddddeeee <<<<ccccppppuuuusssseeeetttt....hhhh>>>>
  13.  
  14.      ccccppppuuuusssseeeetttt____PPPPIIIIDDDDLLLLiiiisssstttt____tttt ****ccccppppuuuusssseeeettttGGGGeeeettttPPPPIIIIDDDDLLLLiiiisssstttt((((cccchhhhaaaarrrr ****qqqqnnnnaaaammmmeeee))));;;;
  15.  
  16. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  17.      The _c_p_u_s_e_t_G_e_t_P_I_D_L_i_s_t function is used to obtain a list of the PIDs for
  18.      all processes currently attached to the specified cpuset. Only processes
  19.      with a user ID or group ID that has read permissions on the permissions
  20.      file can successfully execute this function.
  21.  
  22.      The qqqqnnnnaaaammmmeeee argument is the name of the cpuset to which the current process
  23.      should be attached.
  24.  
  25.      The function returns a pointer to a structure of type ccccppppuuuusssseeeetttt____PPPPIIIIDDDDLLLLiiiisssstttt____tttt
  26.      (defined in <cpuset.h>).  The function _c_p_u_s_e_t_G_e_t_P_I_D_L_i_s_t allocates the
  27.      memory for the structure and the user is responsible for freeing the
  28.      memory using the function _c_p_u_s_e_t_F_r_e_e_P_I_D_L_i_s_t(3x).  The ccccppppuuuusssseeeetttt____PPPPIIIIDDDDLLLLiiiisssstttt____tttt
  29.      structure looks similar to this:
  30.  
  31.                typedef struct {
  32.                    int    count;
  33.                    pid_t  *list;
  34.                } cpuset_PIDList_t;
  35.  
  36.  
  37.      ccccoooouuuunnnntttt is the number of PID values in the list.  lllliiiisssstttt references an array
  38.      that holds the list of PID values.  The memory for lllliiiisssstttt is allocated when
  39.      the ccccppppuuuusssseeeetttt____PPPPIIIIDDDDLLLLiiiisssstttt____tttt is allocated and it is released when the
  40.      ccccppppuuuusssseeeetttt____PPPPIIIIDDDDLLLLiiiisssstttt____tttt structure is released.
  41.  
  42. EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
  43.      This example obtains the list of PIDs attached to the cpuset mpi_set and
  44.      prints out the PID values.
  45.  
  46.                char             *qname = "mpi_set";
  47.                cpuset_PIDList_t *pids;
  48.  
  49.                /* Get the list of PIDs else print error & exit */
  50.                if ( !(pids = cpusetGetPIDList(qname)) ) {
  51.                    perror("cpusetGetPIDList");
  52.                    exit(1);
  53.                }
  54.                if (pids->count == 0) {
  55.                    printf("CPUSET[%s] has 0 processes attached\n",
  56.                            qname);
  57.                } else {
  58.                    int i;
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. ccccppppuuuusssseeeettttGGGGeeeettttPPPPIIIIDDDDLLLLiiiisssstttt((((3333xxxx))))                                      ccccppppuuuusssseeeettttGGGGeeeettttPPPPIIIIDDDDLLLLiiiisssstttt((((3333xxxx))))
  71.  
  72.  
  73.  
  74.                    printf("CPUSET[%s] attached PIDs:\n",
  75.                            qname);
  76.                        for (i = 0; i < pids->count; i++)
  77.                            printf("PID[%d]0, pids->list[i]);
  78.                }
  79.                cpusetFreePIDList(pids);
  80.  
  81.  
  82. NNNNOOOOTTTTEEEESSSS
  83.      _c_p_u_s_e_t_G_e_t_P_I_D_L_i_s_t is found in the library "libcpuset.so", and will be
  84.      loaded if the option _----_llll_cccc_pppp_uuuu_ssss_eeee_tttt is used with _cccc_cccc(1) or _llll_dddd(1).
  85.  
  86. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  87.      cpuset(1), cpusetFreePIDList(3x), cpuset(5).
  88.  
  89. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  90.      If successful, _c_p_u_s_e_t_G_e_t_P_I_D_L_i_s_t returns a pointer to a ccccppppuuuusssseeeetttt____PPPPIIIIDDDDLLLLiiiisssstttt____tttt
  91.      structure.  If _c_p_u_s_e_t_G_e_t_P_I_D_L_i_s_t fails, it returns NULL and eeeerrrrrrrrnnnnoooo is set
  92.      to indicate the error.  The possible values for eeeerrrrrrrrnnnnoooo are the same as the
  93.      values set by _s_y_s_m_p(2) and _s_b_r_k(2).
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.